<template>
  <div class="container">
    <baleTable
      :tableData="tableData"
      :tableHead="tableHead"
      :isSearch="true"
      :isTableRowClick="true"
      :tableLoading="tableLoading"
      :page="page"
      @pageSizeChange="pageSizeChange"
      @handleCurrentChange="handleCurrentChange"
      @searchMethods="searchMethods"
      @handleRowClick="handleRowClick"
      @tableSortChange="tableSortChange"
      ref="baleTable"
    >
      <!--  <template #headLeft>
        <div
          class="ml10 tableStats-btn tableStats-btn-active"
          @click="showDialog"
        >
          添加
        </div>
      </template> -->
      <template #review_name="{ scope }">
        <span>{{
          scope.row.review_uid == "0" ? "系统" : scope.row.review_name
        }}</span>
      </template>

      <!--    操作 -->
      <template #tableOperation="{ scope }">
        <!--  <el-button type="danger" size="small" @click="userList(scope.row.id)"
          >用户订单列表</el-button
        > -->
        <div @click.stop="">
          <el-button
            type="primary"
            size="small"
            :disabled="scope.row.review_result != '待审核'"
            @click="showDialog(scope.row)"
            >审核</el-button
          >
        </div>
      </template>
    </baleTable>
    <DetailDialog ref="DetailDialog" @refresh="getTableData"></DetailDialog>
    <!-- 
    <menuDialog ref="dialog" @refresh="getTableData"></menuDialog> -->
    <!--   <userList ref="userListDialog"></userList> -->
    <detail
      ref="orderDetail"
      @refresh="handleSelectTableType(tableType)"
    ></detail>
  </div>
</template>

<script>
import { ApiOrderRefundList, ApiGetOrderDetail } from "@a/index";
import { tableHead } from "./config";
/* import menuDialog from "./component/basicDialog.vue"; */
//获取用户列表数据
/* import userList from "./component/userList.vue"; */
import tablePrImg from "@/components/tablePrImg.vue";
import DetailDialog from "./components/DetailDialog.vue";
import detail from "../projectConfiguration/orderList/component/detail.vue";
export default {
  components: {
    /*    menuDialog, */
    tablePrImg,
    DetailDialog,
    detail,
    /*   userList, */
  },
  data() {
    return {
      tableHead,
      tableData: [],
      page: {
        page: 1,
        size: 25,
        total: 0,
      },
      tableLoading: false,
      searchParams: {},
      sortParams: {},
      editFormVisible: false,
      btnLoading: false,
    };
  },
  mounted() {
    this.getTableData();
  },
  methods: {
    //编辑界面
    onEdit() {},
    showDialog(val) {
      this.$refs.DetailDialog.show(val);
    },
    userList(id) {
      this.$router.push({
        name: "detail",
        params: { id },
      });
    },
    getTableData(params = {}) {
      let postParams = {
        ...params,
        ...this.searchParams,
        ...this.sortParams,
        ...this.page,
      };
      this.tableLoading = true;
      ApiOrderRefundList(postParams).then((res) => {
        let { data, page } = res;
        this.tableData = data;
        this.page.total = page.total;
        this.tableLoading = false;
      });
    },
    searchMethods(params) {
      console.log("1111", params);
      this.searchParams = {};
      this.page.page = 1;
      this.searchParams = params;
      this.getTableData();
    },
    pageSizeChange(val) {
      this.page.size = val;
      this.getTableData();
    },
    handleCurrentChange(val) {
      this.page.page = val;
      this.getTableData();
    },
    tableSortChange(params) {
      if (params.sort_str) {
        this.sortParams = { ...this.sortParams, ...params };
      } else {
        delete this.sortParams.sort_str;
        delete this.sortParams.sort_order;
      }
      this.page.page = 1;
      this.getTableData();
    },
    handleRowClick(row) {
      ApiGetOrderDetail(row.row.order_id).then((res) => {
        this.$refs.orderDetail.show(res.data);
      });
    },
  },
};
</script>

<style lang="less" scoped></style>
